<template>
  <u-parse v-if="content" style="text-indent: 0;" :html="content" :show-with-animation="true" :lazy-load="true"></u-parse>

</template>

<script>
import RichTextContentUrl from '../../../../../../../components/richtext/web/pc/richtext/RichTextContentUrl.js'
export default {
  name: "richText",
  data(){
    return {
      // 富文本编码，接收上个页面传递值
      code: '',
      // 导航标题，接收上个页面传递值
      title: '',
      content: ''
    }
  },
  onLoad(options){
    this.code = options.code
    this.title = options.title
    this.loadData()
  },
  onReady(){
    // 动态设置富文本标题
    uni.setNavigationBarTitle({
      title: this.title
    })
  },
  methods: {
    loadData(){
      if(this.code){
        this.$http.get(this.$stStringTools.replaceb(RichTextContentUrl.getByCode,{code: this.code}))
        .then(res => {
          this.content = res.data.content
        })
      }
    }
  }
}
</script>

<style scoped>

</style>